<template>
  <div ref="line"></div>
</template>

<script>
//引包
import * as echarts from "echarts";
export default {
  name: "",
  //因为可以获取容器
  mounted() {
    //初始化echarts实例
    let mycharts = echarts.init(this.$refs.line);
    //设置配置项
    let options = {
      grid:{
        left:0,
        top:0,
        // right:0,
        bottom:0
      },
      xAxis: {
        show: false,
        min:0,
        max:100,
      },
      yAxis: {
        show: false,
        type:'category',
      },
      series: {
        type: "bar",
        data: ['78'],
        color: "yellowgreen",
        //柱状图的宽度设置
        barWidth: 10,
        showBackground:true,
        //设置柱状图的背景颜色
        backgroundStyle:{
           color:'#ddd'
        },
        label:{
          show:true,
          position: 'right',
          formatter:'|',
          color:'yellowgreen',
        }
      },
    };
    //设置配置项
    mycharts.setOption(options);
  },
};
</script>

<style scoped>
div {
  width: 100%;
  height: 100%;
}
</style>
